{% extends "admin/change_list.html" %}
{% load i18n admin_urls static admin_list %}


{% block title %} 数据字典 | 元数据管理平台 {% endblock %}

{% block content_title %} 数据字典 {% endblock %}


{% block breadcrumbs %}
<ol class="breadcrumb">
    <li><a href="{% url 'admin:index' %}"><i class="fa fa-dashboard"></i> {% trans 'Home' %}</a></li>
    <li><a href="/admin/metadata/hivetableinfo">元数据管理</a></li>
    <li class="active">数据字典</li>
</ol>
{% endblock %}

{% block content %}
<div class="col-md-12">
    <div class="box-primary" style="height:650px;">

        <div class="row col-center-block search-row text-center">

            <input type="text" name="search_key" id="search_key" placeholder="输入表名、列名或描述信息" class="search-query input-key" />
            <button type="button" class="btn btn-primary" id="index_search"> 搜 索</button>
        </div>

        <div class="row row_margin_top">

            <div class="col-md-4">
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h3 class="panel-title">访问排行</h3>
                    </div>
                    <div class="panel-body">
                        <ul class="panel-ul">
                            {% for hot in hotInfo %}
                            <li class="panel-list">
                                <a href="{{ hot.url }}" target="_blank">{{ hot.table_name }}</a>-{{ hot.table_content }}
                            </li>
                            {% endfor %}

                        </ul>
                    </div>
                </div>
            </div>

            <div class="col-md-4">
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h3 class="panel-title">依赖排行</h3>
                    </div>
                    <div class="panel-body">
                        <ul class="panel-ul">
                            {% for reply in replyInfo %}
                            <li class="panel-list">
                                <a href="{{ reply.url }}" target="_blank">{{ reply.table_name }}</a>-{{ reply.table_content }}
                            </li>
                            {% endfor %}
                        </ul>
                    </div>
                </div>
            </div>


            <div class="col-md-4">
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h3 class="panel-title">占用空间排行</h3>
                    </div>
                    <div class="panel-body">
                        <ul class="panel-ul">
                            {% for disk in diskInfo %}
                            <li class="panel-list">
                                <a href="{{ disk.url }}" target="_blank">{{ disk.table_name }}</a>-{{ disk.table_content }}
                            </li>
                            {% endfor %}
                        </ul>
                    </div>
                </div>
            </div>

        </div>

    </div>

</div>

{% endblock %}

{% block extrajs %}

<style type="text/css">
    .col-center-block {
        float: none;
        display: block;
        margin-left: auto;
        margin-right: auto;
    }
    .search-row{
        padding-top: 60px;
    }
    .input-key{
        width: 380px;
        height: 40px;
        margin-right: 15px;
    }

     .panel-list{
            position: relative;
            display: block;
            padding-top: 5px;
     }
    .panel-ul{
        padding-left: 5px;
    }
     .row_margin_top{margin-top:30px;}
</style>
<script>

document.onkeydown = function(event){
　　var event=document.all?window.event:event;
　　if((event.keyCode || event.which) == 13){
　　　　//alert('jsjs');

        var search_key = $("#search_key").val();
        window.location.href="/admin/metadata/hivesearch/?search_key=" + search_key;
　　}
}

$("#search_key").focus()

$("#index_search").click(function(){
    var search_key = $("#search_key").val();
    window.location.href="/admin/metadata/hivesearch/?search_key=" + search_key;
})
</script>
{% endblock %}